home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple Reference & Presen…rary 6 (Reseller Edition)
/
Apple Ref. & Pres. Lib.v6.0.toast
/
pc
/
3-Presentations
/
Markets
/
Education
/
HyperCard In Education
/
Iceberg
/
background_2660.txt
< prev
next >
Wrap
Text File
|
1990-04-02
|
20KB
|
837 lines
-- background: 2660 from stack: in
-- bmap block id: 4449
-- flags: 4000
-- background id: 0
-- name: Function Plotter
----- HyperTalk script -----
-- Copyright © 1988 Cincinnati Country Day School. All rights reserved.
-- For information, contact Joseph F. Hofmeister, Computer Coordinator
-- The HyperSchool, Cincinnati Country Day School, AppleLink K0197
-- 6905 Given Road, Cincinnati, Ohio 45243. 513-561-7298.
on openStack
hide message
set the loc of message to 22,38
initGraph
select text of field fa
end openStack
on closeStack
hide message
set the loc of message to 22,300
end closeStack
on initGraph
global gLeft, gTop, gUnit, gRSize
global gHMid, gVMid, gRight, gBottom
global rUnit, deltaA
put 250 into gLeft
put 81 into gTop
put 12 into gUnit
put 10 into gRSize
put gLeft + gRSize * gUnit into gHMid
put gTop + gRSize * gUnit into gVMid
put gLeft + gRSize * gUnit * 2 into gRight
put gTop + gRSize * gUnit * 2 into gBottom
put field frUnit into rUnit
put pi/50 into deltaA
setScale rUnit
domainExp
end initGraph
on eraseGraph
global gLeft, gTop, gRight, gBottom
if the visible of bkgnd button "Erase Graph" is true then
choose select tool
drag from gLeft - 4, gTop - 4 to gRight + 4, gBottom + 4
doMenu "Clear Picture"
choose browse tool
end if
set the visible of bkgnd button "Erase Graph" to false
end eraseGraph
on drawGraphBox
global gLeft, gTop, gUnit, gRSize
global gHMid, gVMid, gRight, gBottom
initGraph
set the editBkgnd to true
choose select tool
drag from 0,0 to 512,342
doMenu "Clear Picture"
choose oval tool
set pattern to 13
set lineSize to 1
put gLeft into ovL
put gTop into ovT
put gRight into ovR
put gBottom into ovB
repeat until ovR ≤ ovL or ovB ≤ ovT
drag from ovL, ovT to ovR, ovB with optionKey
add gUnit to ovL
add gUnit to ovT
subtract gUnit from ovR
subtract gUnit from ovB
end repeat
choose line tool
drag from gLeft, gVMid to gRight, gVMid with optionKey
drag from gLeft, gBottom to gRight, gTop with optionKey
drag from gHMid, gBottom to gHMid, gTop with optionKey
drag from gRight, gBottom to gLeft, gTop with optionKey
choose rectangle tool
drag from gLeft, gTop to gRight, gBottom
set the rect of field rUnitLabel to gLeft - 54, gVMid - 11, gLeft - 4, gVMid + 1
put "r unit =" into field rUnitLabel
set the rect of field frUnit to gLeft - 54, gVMid, gLeft - 4, gVMid + 12
put 1 into field frUnit
get the topLeft of field scaleLabel
subtract 3 from item 1 of it
subtract 1 from item 2 of it
put it into tl
get the botRight of bkgnd button id 73
add 3 to item 1 of it
add 3 to item 2 of it
set the lineSize to 2
drag from tl to it
reset paint
choose browse tool
end drawGraphBox
on setScale newUnit
global gRSize, xCorner, yCorner, rUnit
put -gRSize * newUnit into xCorner
put xCorner into yCorner
put newUnit into rUnit
end setScale
on changeScale newUnit
global rUnit
if rUnit ≠ newUnit then
setScale newUnit
put rUnit into field frUnit
eraseGraph
else
answer "The r unit is already" && rUnit
end if
end changeScale
on domainExp
global dExpL, dExpR
if the hilight of bkgnd button domainLLT is true then
put "a >" && field domainLL into dExpL
else
put "a ‚â•" && field domainLL into dExpL
end if
if the hilight of bkgnd button domainULT is true then
put "a <" && field domainUL into dExpR
else
put "a ≤" && field domainUL into dExpR
end if
end domainExp
function leftOfDomain a
global dExpL
if dExpL is empty then
return false
else
return not the value of dExpL
end if
end leftOfDomain
function inDomain a
global dExpL, dExpR
if dExpL is empty then
return true
else
return the value of dExpL and the value of dExpR
end if
end inDomain
function rightOfDomain a
global dExpR
if dExpR is empty then
return false
else
return not the value of dExpR
end if
end rightOfDomain
function xPtoC p
global gLeft, gUnit, xCorner, rUnit
return xCorner + ( p - gLeft ) / gUnit * rUnit
end xPtoC
function yPtoC p
global gBottom, gUnit, yCorner, rUnit
return yCorner - ( p - gBottom ) / gUnit * rUnit
end yPtoC
function xCtoP c
global gLeft, gRight, gUnit, xCorner, rUnit
return gLeft + round(( c - xCorner ) / rUnit * gUnit )
end xCtoP
function yCtoP c
global gTop, gBottom, gUnit, yCorner, rUnit
return gBottom - round(( c - yCorner ) / rUnit * gUnit )
end yCtoP
function xCtoPClip c
global gLeft, gRight, gUnit, xCorner, rUnit
get gLeft + round(( c - xCorner ) / rUnit * gUnit )
if it < gLeft then
return gLeft
else
if it > gRight then
return gRight
else
return it
end if
end if
end xCtoPClip
function yCtoPClip c
global gTop, gBottom, gUnit, yCorner, rUnit
get gBottom - round(( c - yCorner ) / rUnit * gUnit )
if it < gTop then
return gTop
else
if it > gBottom then
return gBottom
else
return it
end if
end if
end yCtoPClip
on polarToRect
global deltaA, fxCmd, a, x0, y0, x1, y1
put x1 into x0
put y1 into y0
do fxCmd
put xCtoPClip( r * cos( a )) into x1
put yCtoPClip( r * sin( a )) into y1
add deltaA to a
end polarToRect
on plotFunction
global fxCmd, a, x0, y0, x1, y1
if line 1 of field fa is empty then
answer "Specify f(a) first."
else
put "Now plotting f(a) =" && line 1 of field fa into message
set the visible of bkgnd button "Erase Graph" to true
put "put" && line 1 of field fa && "into r" into fxCmd
reset paint
choose line tool
put the value of field domainLL into a
if leftOfDomain( a ) then add 0.000001 to a
put the value of field domainUL into lastA
if rightOfDomain( lastA ) then subtract 0.000001 from lastA
polarToRect
repeat forever
if rightOfDomain( a ) then exit repeat
polarToRect
drag from x0, y0 to x1, y1
end repeat
put lastA into a
polarToRect
drag from x0, y0 to x1, y1
put empty into message
hide message
choose browse tool
end if
end plotFunction
-- part 1 (field)
-- low flags: 00
-- high flags: 0002
-- rect: left=156 top=30 right=45 bottom=505
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 2
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: fa
-- part 36 (button)
-- low flags: 00
-- high flags: A005
-- rect: left=166 top=52 right=70 bottom=274
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Limit Domain
----- HyperTalk script -----
on mouseUp
put 0 into field domainLL
put "2*pi" into field domainUL
send mouseUp to bkgnd button domainLLE
send mouseUp to bkgnd button domainULE
if the highlight of bkgnd button "Limit Domain" is true then
set the lockText of field domainLL to false
set the lockText of field domainUL to false
set the rect of bkgnd button dLimitMask to 276,45,497,46
select text of field domainLL
else
set the lockText of field domainLL to true
set the lockText of field domainUL to true
set the rect of bkgnd button dLimitMask to 276,45,497,76
select text of field fa
end if
domainExp
end mouseUp
-- part 37 (field)
-- low flags: 01
-- high flags: 0002
-- rect: left=278 top=53 right=68 bottom=360
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 65535
-- font id: 2
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: domainLL
----- HyperTalk script -----
on openField
global oldVal
put field domainLL into oldVal
end openField
on closeField
global oldVal
domainExp
if field domainUL < field domainLL or ( field domainUL = field domainLL and not inDomain( field domainUL )) then
answer "Not a valid domain."
put oldVal into field domainLL
domainExp
select text of field domainLL
end if
end closeField
-- part 39 (button)
-- low flags: 00
-- high flags: 0006
-- rect: left=359 top=47 right=61 bottom=377
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: domainLLT
----- HyperTalk script -----
on mouseUp
if field domainLL = field domainUL then
answer "Not a valid domain."
else
set the hilight of bkgnd button domainLLE to false
set the hilight of bkgnd button domainLLT to true
domainExp
end if
end mouseUp
-- part 40 (button)
-- low flags: 00
-- high flags: 4006
-- rect: left=359 top=60 right=74 bottom=377
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: domainLLE
----- HyperTalk script -----
on mouseUp
set the hilight of bkgnd button domainLLT to false
set the hilight of bkgnd button domainLLE to true
domainExp
end mouseUp
-- part 41 (button)
-- low flags: 00
-- high flags: 0006
-- rect: left=396 top=47 right=61 bottom=414
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: domainULT
----- HyperTalk script -----
on mouseUp
if field domainLL = field domainUL then
answer "Not a valid domain."
else
set the hilight of bkgnd button domainULE to false
set the hilight of bkgnd button domainULT to true
domainExp
end if
end mouseUp
-- part 42 (button)
-- low flags: 00
-- high flags: 4006
-- rect: left=396 top=60 right=74 bottom=414
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: domainULE
----- HyperTalk script -----
on mouseUp
set the hilight of bkgnd button domainULT to false
set the hilight of bkgnd button domainULE to true
domainExp
end mouseUp
-- part 44 (field)
-- low flags: 01
-- high flags: 0002
-- rect: left=413 top=53 right=68 bottom=495
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 2
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: domainUL
----- HyperTalk script -----
on openField
global oldVal
put field domainUL into oldVal
end openField
on closeField
global oldVal
domainExp
if field domainUL < field domainLL or ( field domainUL = field domainLL and not inDomain( field domainUL )) then
answer "Not a valid domain."
put oldVal into field domainUL
domainExp
select text of field domainUL
end if
end closeField
-- part 51 (field)
-- low flags: 01
-- high flags: 0001
-- rect: left=120 top=30 right=45 bottom=156
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 65535
-- font id: 2
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: fxLabel
-- part 55 (button)
-- low flags: 00
-- high flags: 0001
-- rect: left=126 top=315 right=339 bottom=161
-- title width / last selected line: 0
-- icon id / first selected line: 25002 / 25002
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Help
----- HyperTalk script -----
on mouseUp
set the visible of field Help to not visible of field Help
end mouseUp
-- part 59 (field)
-- low flags: 01
-- high flags: 0000
-- rect: left=388 top=48 right=73 bottom=400
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: domainULLabel
-- part 60 (field)
-- low flags: 01
-- high flags: 0000
-- rect: left=379 top=52 right=68 bottom=391
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 2
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: domainALabel
-- part 61 (field)
-- low flags: 01
-- high flags: 0000
-- rect: left=372 top=48 right=73 bottom=384
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: domainLLLabel
-- part 45 (button)
-- low flags: 00
-- high flags: 0001
-- rect: left=276 top=45 right=76 bottom=497
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: dLimitMask
-- part 62 (button)
-- low flags: 00
-- high flags: A004
-- rect: left=4 top=24 right=52 bottom=106
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 2
-- text size: 14
-- style flags: 2048
-- line height: 18
-- part name: Iceberg
----- HyperTalk script -----
on mouseUp
if the visible of field Help is true then
set the visible of field "Help" to false
else
set the visible of field Author to true
set the visible of bkgnd button OK to true
end if
end mouseUp
-- part 65 (field)
-- low flags: 01
-- high flags: 0001
-- rect: left=196 top=190 right=202 bottom=246
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 2
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: rUnitLabel
-- part 66 (field)
-- low flags: 01
-- high flags: 0001
-- rect: left=196 top=201 right=213 bottom=246
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 2
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: frUnit
-- part 69 (button)
-- low flags: 00
-- high flags: A004
-- rect: left=24 top=258 right=274 bottom=94
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: 3
----- HyperTalk script -----
on mouseUp
get the short name of bkgnd button id 69
changeScale it
if it ≠ 3000 then
set the name of bkgnd button id 69 to the short name of bkgnd button id 70
set the name of bkgnd button id 70 to 10 * it
set the name of bkgnd button id 72 to the short name of bkgnd button id 71
set the name of bkgnd button id 71 to the short name of bkgnd button id 69 / 10
end if
end mouseUp
-- part 70 (button)
-- low flags: 00
-- high flags: A004
-- rect: left=96 top=258 right=274 bottom=166
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: 10
----- HyperTalk script -----
on mouseUp
get the short name of bkgnd button id 70
changeScale it
if it ≠ 10000 then
set the name of bkgnd button id 69 to the short name of bkgnd button id 69 * 10
set the name of bkgnd button id 70 to the short name of bkgnd button id 70 * 10
set the name of bkgnd button id 71 to the short name of bkgnd button id 71 * 10
set the name of bkgnd button id 72 to the short name of bkgnd button id 72 * 10
end if
end mouseUp
-- part 71 (button)
-- low flags: 00
-- high flags: A004
-- rect: left=24 top=276 right=292 bottom=94
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: 0.3
----- HyperTalk script -----
on mouseUp
get the short name of bkgnd button id 71
changeScale it
if it ≠ 0.0003 then
set the name of bkgnd button id 71 to the short name of bkgnd button id 72
set the name of bkgnd button id 72 to it / 10
set the name of bkgnd button id 70 to the short name of bkgnd button id 69
set the name of bkgnd button id 69 to the short name of bkgnd button id 71 * 10
end if
end mouseUp
-- part 72 (button)
-- low flags: 00
-- high flags: A004
-- rect: left=96 top=276 right=292 bottom=166
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: 0.1
----- HyperTalk script -----
on mouseUp
get the short name of bkgnd button id 72
changeScale it
if it ≠ 0.0001 then
set the name of bkgnd button id 69 to the short name of bkgnd button id 69 / 10
set the name of bkgnd button id 70 to the short name of bkgnd button id 70 / 10
set the name of bkgnd button id 71 to the short name of bkgnd button id 71 / 10
set the name of bkgnd button id 72 to the short name of bkgnd button id 72 / 10
end if
end mouseUp
-- part 73 (button)
-- low flags: 00
-- high flags: A004
-- rect: left=24 top=294 right=310 bottom=166
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: 1 (Standard Scale)
----- HyperTalk script -----
on mouseUp
changeScale 1
set the name of bkgnd button id 69 to 3
set the name of bkgnd button id 70 to 10
set the name of bkgnd button id 71 to 0.3
set the name of bkgnd button id 72 to 0.1
end mouseUp
-- part 74 (field)
-- low flags: 01
-- high flags: 0001
-- rect: left=24 top=244 right=257 bottom=165
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 2
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: unitLabel
-- part 75 (field)
-- low flags: 01
-- high flags: 0001
-- rect: left=24 top=231 right=245 bottom=165
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 2
-- text size: 10
-- style flags: 256
-- line height: 13
-- part name: scaleLabel
-- part 77 (button)
-- low flags: 00
-- high flags: A004
-- rect: left=43 top=81 right=103 bottom=146
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Plot f(a)
----- HyperTalk script -----
on mouseUp
plotFunction
select text of field fa
end mouseUp
-- part 78 (button)
-- low flags: 80
-- high flags: A004
-- rect: left=43 top=105 right=127 bottom=146
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Erase Graph
----- HyperTalk script -----
on mouseUp
eraseGraph
select text of field fa
end mouseUp
-- part 76 (field)
-- low flags: 81
-- high flags: 0007
-- rect: left=4 top=70 right=227 bottom=247
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 2
-- text size: 12
-- style flags: 0
-- line height: 14
-- part name: Help
----- HyperTalk script -----
on mouseUp
set the visible of field Help to not visible of field Help
end mouseUp
-- part 79 (field)
-- low flags: 81
-- high flags: 2004
-- rect: left=4 top=71 right=225 bottom=247
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 2
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: Author
-- part 80 (button)
-- low flags: 80
-- high flags: 8003
-- rect: left=173 top=197 right=219 bottom=241
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: OK
----- HyperTalk script -----
on mouseUp
set the visible of bkgnd button OK to false
set the visible of field Author to false
end mouseUp